{% extends "frontend/common/base.html" %}<!--继承基础模板-->
{% block content %}<!--自定义模板区域-->
<head>
    <meta charset="UTF-8">
    <title>消息提示</title>
    <style>
    #Time,#p{
     font-size: 25px;
     text-align: center;
     }
    #msg,#h3{
     font-size: 35px;
     text-align: center;
     }
    #url,#p{
     font-size: 15px;
     text-align: center;
     }


    </style>
</head>
<body>
<h3 id="msg">{{msg}}</h3>
<p id="Time">{{time|default(5)}}</p>
<p id="url">即将跳转：<a href="{{url}}">{{url}}</a></p>
<script>
    //使用匿名函数方法
    function countDown() {
        let time = document.getElementById("Time");
        let time_second = parseInt(time.innerHTML)
        //获取到id为time标签中的内容，现进行判断
        if (time_second <= 0) {
            //等于0时清除计时
            window.location.href = "{{url}}"
        } else {
            let next_time = time_second - 1
            time.innerHTML = next_time.toString();
        }
    }

    //1000毫秒调用一次
    window.setInterval(countDown, 1000);


</script>
{% endblock %}